/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.ncsu.csc573.project1.util;

/**
 *
 * @author svpendse1
 */
public class PeerData implements Comparable<PeerData> {
    private String hostName;
    private int portNumber;

    public PeerData(String hostName, int portNumber) {
        this.hostName = hostName;
        this.portNumber = portNumber;
    }

    public String getHostName() {
        return hostName;
    }

    public int getPortNumber() {
        return portNumber;
    }
    
    public void setHostName(String hostName) {
        this.hostName = hostName;
    }

    public void setPortNumber(int portNumber) {
        this.portNumber = portNumber;
    }

    @Override
    public int compareTo(PeerData d) {
        if (this.hostName.equals(d.hostName) && this.portNumber == d.portNumber) {
            return 0;
        }
        return 1;
    }

    @Override
    public boolean equals(Object o) {
        PeerData d = (PeerData) o;
        if (this.hostName.equals(d.hostName) && this.portNumber == d.portNumber) {
            return true;
        }
        return false;
    }
}
